package com.example.day2.methodref;

import java.util.function.Consumer;
import java.util.function.Function;

public class MethodRef6 {
        public static void main(String[] args) {
        Consumer<Object> x = MethodRef6::print1;
        Function<Object, Integer> y = MethodRef6::print2;
        Consumer<Object> z = MethodRef6::print2;

        /*
            特例: 对于无需返回值的函数接口，例如 Consumer 和 Runnable
                 它们可以配合有返回值的函数对象使用
         */
    }

    static void print1(Object obj) {
        System.out.println(obj);
    }

    static int print2(Object obj) {
        System.out.println(obj);
        return 1;
    }
}
